<div class="alert alert-warning alert-dismissable" style="position: absolute; bottom: 0; width: 100%; display: none">
  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  <h4><i class="icon fa fa-warning"></i></h4>
</div>

<!--错误提示框加载-->
<script type="text/javascript">
    $(function () {
        <% if alert && alert.errors.size > 0 %>
        <%error_item, error_message = alert.errors.first%>
        $('<%="\##{alert.class.name.downcase}_#{error_item}"%>').parent().addClass('has-error')
        $('.alert').children('h4').append("<%=error_item.to_s.capitalize + ': ' + error_message%>")
        $('.alert').appendTo($('body')).show()
        $('<%="\##{alert.class.name.downcase}_#{error_item}"%>').focusin(function(){
            $(this).parent().removeClass('has-error')
        })
        <% end %>
    })

</script>